{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 函数的使用步骤"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "恭喜您登录成功\n",
      "显示余额\n",
      "存款\n",
      "取款\n",
      "********************\n",
      "查询余额完毕\n",
      "显示余额\n",
      "存款\n",
      "取款\n",
      "********************\n",
      "取了2000元钱\n",
      "显示余额\n",
      "存款\n",
      "取款\n",
      "********************\n"
     ]
    }
   ],
   "source": [
    "# 2. “选择功能”界面\n",
    "# +\n",
    "# 3. 封装函数\n",
    "def select_func():\n",
    "    print(\"显示余额\")\n",
    "    print(\"存款\")\n",
    "    print(\"取款\")\n",
    "    print(\"*\"*20)\n",
    "\n",
    "\n",
    "# 1. 搭建整体框架\n",
    "'''\n",
    "输入密码登陆后显示功能\n",
    "查询余额后显示功能\n",
    "取完钱后显示功能\n",
    "'''\n",
    "print(\"恭喜您登录成功\")\n",
    "# 显示\"选择功能\"界面\n",
    "select_func()\n",
    "\n",
    "print('查询余额完毕')\n",
    "# 显示\"选择功能\"界面\n",
    "select_func()\n",
    "\n",
    "print('取了2000元钱')\n",
    "# 显示\"选择功能\"界面\n",
    "select_func()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 结论\n",
    "\n",
    "1. 函数先定义后调用，如果先调用会报错\n",
    "2. 如果没有调用函数，函数里面的代码不会执行\n",
    "3. 函数执行流程\n",
    "  当调用函数的时候，解释器回到定义函数的地方去执行下方缩进的代码\n",
    "  当这些代码执行完，回到调用函数的地方继续向下执行\n",
    "  定义函数的时候，函数体内部缩进的代码并没有执行"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python [conda env:root] *",
   "language": "python",
   "name": "conda-root-py"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
